sudoers file

Linux Users & Sudo :

Sudoers File

  • Location: /etc/sudoers
  • Controls who can use sudo (run commands as admin).
  • Example:
    %sudo   ALL=(ALL:ALL) ALL
    
    → Anyone in the sudo group can run any command as admin.
  • Always edit with:
    sudo visudo
    

Useful Commands

  • Check what you can run with sudo:
    sudo -l
    
  • Become root:
    sudo su     # root shell
    sudo -i     # root login shell
    
  • See who’s in the sudo group:
    grep 'sudo' /etc/group
    

Pasted image 20250618211118.png


Key Files

  • /etc/passwd → Lists all users (username, home folder, shell).
  • /etc/shadow → Stores encrypted passwords (only root can read).
  • /etc/group → Lists groups and members.

Pentesting/CTF Tip

  • /etc/passwd shows usernames and services.
  • /etc/shadow (if you can read it) has password hashes that attackers might crack.
  • Knowing users = important step in hacking challenges.